<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 点击所有LI标签生效 -->
    <ul id="list">
        <li>列表一</li>
        <li>列表二</li>
        <li>列表三</li>
        <li>列表四</li>
        <p>哈哈砂浆</p>
    </ul>

    <script>
        var list = document.getElementById("list");
        // list.onclick = function(){
        //     console.log("点击了");
        // }
        list.addEventListener("click",function(event){
            // event.target.tarName.toLowerCase()==="li" 转换成小写
            if(event.target.tagName === "LI"){

                console.log(event.target.innerHTML);
            }
        })
    </script>
</body>
</html>